const mysql = require('mysql');

var connection = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'root',
    database: 'demhem'
});
//执行连接
connection.connect();
connection.query('DELETE FROM student WHERE id=?',[26],(error, results) => {
    if(error) {
        console.log('err ===>',error);
        console.log('delete 失败')
    }
    console.log('results====>',results);
    if(results.affectedRows == 1) {
        console.log('delete 成功')
    }

})
//关闭
connection.end();